/*
 * Project: BoboDesignPattern
 * 
 * File Created at 2019年9月15日
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package test.scattered2.myrpc.client;

import java.lang.reflect.Proxy;

/**
 * @Type RPCClientProxy
 * @Desc
 * @author 52489
 * @date 2019年9月15日
 * @Version V1.0
 */
public class RPCClientProxy {
    // 动态代理：java原生proxy/cglib、javaassist/asm

    public <T> T clientProxy(Class<T> interfaceCls, String host, Integer port) {
        return (T) Proxy.newProxyInstance(interfaceCls.getClassLoader(), new Class<?>[] { interfaceCls },
                new RemoteInvocationHandler(host, port));
    }

}
